package com.kcyu.sfherp.controller;


import com.kcyu.sfherp.entity.Custom;
import com.kcyu.sfherp.service.CustomService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@Api(tags="客户相关接口")
@RequestMapping("/custom")
public class CustomController {

    @Autowired
    private CustomService customService;

    @GetMapping("/query/{khinfo}")
    public Map<Object,Object> queryCustomInfoByNameOrBh(@PathVariable String khinfo){
        List<Custom> customs = customService.queryCustomInfoByNameOrBh(khinfo);
        HashMap<Object, Object> map = new HashMap<>();
        map.put("code", 200);
        map.put("data",customs);
        map.put("length",customs.size());
        return map;
    }

}
